//
//  UIScrollView+AllowPanGestureEventPass.m
//  TengyunStation
//
//  Created by Johnny on 15/9/7.
//  Copyright (c) 2015年 xingrong. All rights reserved.
//

#import "UIScrollView+AllowPanGestureEventPass.h"

@implementation UIScrollView (AllowPanGestureEventPass)

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
    if ([gestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]]
        && [otherGestureRecognizer isKindOfClass:[UIScreenEdgePanGestureRecognizer class]] && self.contentOffset.x == 0) {
        if (self.contentSize.width > 320) {
            if (gestureRecognizer.state == 1) {
                return YES;
            }
        } else {
            if (gestureRecognizer.state == 0) {
                return YES;
            }
        }
    }
    return  NO;
}

@end
